const User = require("../../model/User");

exports.addShopValidate = async (req, res, next) => {
  // 验证参数
  if (!req.body.createBy) {
    throw "创建人不能为空";
  } else {
    const user = await User.findOne({
      where: {
        id: req.body.createBy,
      },
    });
    if (!user) {
      throw "用户不存在";
    }
  }
  if (!req.body.name) {
    throw "商户名字不能为空";
  }
  if (!req.body.phone) {
    throw "手机号不能为空";
  }
}

exports.getShopValidate = async (req) => {
  // 验证参数
  if (!req.query.id) {
    throw "所属用户id不能为空";
  }
}